Skip to content

Harden edit_transaction type repair, read-block diagnostics, and orchestrator spawn guidance#25

Merged
AnzoBenjamin merged 16 commits into
mainfrom
fix/reviewer-gate-hardening
Jul 23, 2026
Merged

Harden edit_transaction type repair, read-block diagnostics, and orchestrator spawn guidance#25
AnzoBenjamin merged 16 commits into
mainfrom
fix/reviewer-gate-hardening

Conversation

@AnzoBenjamin

@AnzoBenjamin AnzoBenjamin commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Hardens the deterministic edit/read subsystem and the orchestrator agent-spawn guidance based on failures observed in live sessions.

edit_transaction + read diagnostics

  • normalizeTransactionEditList now canonicalizes/repairs invalid-but-unambiguous edit type values and exports TRANSACTION_EDIT_TYPES.
  • The discriminator validation hint names the offending edits[i].type value.
  • The strict read-before-edit block message explains the same-step-read / context-compaction authorization drop.
  • Removed a dead currentStatusLines param and extractGitStatusLineMap helper; cancel the background reviewer job before clearing its id in the reviewer-skip branch.

Orchestrator spawn guidance (base2 / shared advisory prompt sections)

  • base2 routes ripgrep-style search through code-searcher since code_search/find_files_matching_content are not root-granted tools.
  • git-committer guidance: params.owned_paths is required and the key is literally owned_paths (not paths/filePaths/files); documents the Missing required: owned_paths and "Spawning git-committer is not available yet" (gate-ordering) failures.
  • specialistRoutingSection names the exact snapshot param contract (reviewer-family need params.snapshot_id from get_change_review_bundle; security-reviewer needs changed_files + snapshot_fingerprint).
  • base2 names required spawn params for code-searcher (params.searchQueries) and basher (params.command).

Tests

All changes covered by unit/topic-coverage tests (common coerce-to-array, agent-runtime tool-validation-error, agents quality-prompt-snapshot). Full-repo typecheck clean; prompt suite green.

Commits: 8830561, 6a42440, ee1a920.


This change is Reviewable

…/edit_transaction diagnostics

- Inline the applied-action predicate in editor.ts hasEditArtifact/visit so the gate-files parity test's new Function reconstruction no longer hits a ReferenceError (CI fix).

- Add buildUnavailableToolMessage: distinguish registered-but-ungranted tools from typos and suggest the closest granted tool name.

- Add an explicit type-discriminator hint for edit_transaction union failures.

- Document tool availability/unavailable-tool errors and the edit_transaction explicit type requirement.
…te-files copies

Add a static guard in gate-files-parity.test.ts that scans each reconstructed inline gate-files function (base2.ts and editor.ts) for references to callable siblings (function declarations and function-valued const/let bindings) that are not part of the new Function reconstruction set. This fails fast in a unit test rather than only when a parity input reaches the offending branch, catching the hasAppliedMutationAction-class regression.
Remediate long-standing harness cohesion debt and unblock the reviewer gate on large source files.

- Establish a single-source-of-truth agent roster: reconcile AGENT_PERSONAS/AGENT_IDS and routes.json against the bundled roster, prune dead ids, and add a roster-drift guard test.

- Align prompt guidance with actual capabilities: route audit shards through general-agent + write_audit_findings, and drop the production-dead frontendSection re-export.

- Make the orchestrator family consistent: reconcile base-deep/base2-fast spawnable sets with documented, test-asserted per-mode deltas and share editor-handoff guidance across step prompts.

- Add gate/security parity guards for gate-paths helpers and the security-sensitive glob list.

- Quarantine dead tools (find_files, find_files_matching_content, lookup_agent_info, render_ui) so they are not prompt-visible-yet-unreachable, and broaden set_output reachability coverage.

- Clarify discovery-agent boundaries: give basher an explicit workspace-write terminal profile and document file-lister as file-picker's internal worker.

- Mark orchestration/workflow-engine advisory/telemetry-only so it is not mistaken for the authoritative gate.

- Raise MAX_RENDER_CHARS to the 10MB byte gate so reviewers can read and attest to large source files (e.g. base2.ts) instead of receiving a FILE_TOO_LARGE stub; the 10MB byte cap remains the hard ceiling.

Includes durable plan-session artifacts for the audit.
Add regression tests for the str_replace missing-replacement-field formatter so exclusively missing oldString/newString cases surface the missing-required-replacement-fields guidance and mixed issues fall back to the generic formatter.

Reconcile the observed-bytes-floor authorization wording across SPEC, PLAN, and STATUS so all three carry the identical normative rule: a partial range capability never authorizes a whole-file overwrite, and completion claims are described as session history rather than verified evidence.
…ntract

Update four test suites to assert the already-committed cap.v3-only authorization contract and the new optional replace_range contained sub-range API (AC1-AC4). The old suites asserted the removed contract (no startLine/endLine, raw basedOnRead range objects), which broke the CI test-* jobs. Migrating them unblocks those jobs; full suites pass locally (5 common + 29 SDK + 41 agent-runtime).
Surface co-changed test files to the reviewer as readable "Coverage evidence" (non-fingerprinted) so it can confirm test coverage instead of always reporting coverage missing/uncertain. Add isCoverageEvidenceFile/selectCoverageEvidenceFiles to gate-paths.ts with byte-identical inline mirrors in base2's serialized handleSteps.

Harden the git-committer commit gate in tool-executor.ts with a dirtySetUncertain fail-closed guard: a non-empty published dirty set that canonicalizes to empty (or malformed metadata) blocks the commit rather than silently allowing it.

Widen the reviewable/coverage test-file exclusion to JS-flavored tests (.mjs/.cjs/.jsx).

Soften filesystem write-scope enforcement: project-escape (../, absolute, symlink-out-of-root) stays a hard block for read and write; an in-project write outside the declared scope now proceeds with a non-blocking logger.warn; in-project read mismatches stay hard-blocked.

Reclaim the indexer cache lock immediately when its owner process is dead (isLockOwnerDead) instead of waiting out STALE_LOCK_MS.

Add/extend tests: gate-paths selector-predicate coverage, git-committer gate cases, softened write-scope behavior with escape-path regressions, and dead-owner/live-owner index lock reclaim.
…dening

# Conflicts:
#	agents/__tests__/gate-paths-parity.test.ts
#	agents/base2/base2.ts
#	agents/base2/gate-paths.ts
#	packages/agent-runtime/src/__tests__/run-agent-step-tools.test.ts
#	packages/agent-runtime/src/tools/tool-executor.ts
…flavored parity cases

Broaden the inline isReviewableGateFile/isCoverageEvidenceFile regex copies in base2.ts to the (?:tsx?|jsx?|mjs|cjs) test/spec exclusion so they match the canonical helpers in gate-paths.ts after the merge. Add JS-flavored parity cases (.test.js/.spec.mjs/.test.cjs/.spec.jsx) to the gate-paths parity test to lock the inline copies to the broadened form.
normalizeTransactionEditList now canonicalizes case/separator variants of valid edit type values and repairs invalid-but-unambiguous types from the payload shape, and exports TRANSACTION_EDIT_TYPES as the shared source of truth. The discriminator validation hint names the offending edits[i].type value so the caller can see exactly which edit is wrong.

The strict read-before-edit block message now explains why an existing read authorization may have been dropped: a read and edit emitted in the same step do not authorize until the next step, and context compaction revokes earlier implicit reads.

base2 prompt routes ripgrep-style content search through the code-searcher agent, since code_search/find_files_matching_content are registered runtime tools but are intentionally not granted to root and calling them directly is rejected.

Also removes the dead currentStatusLines parameter and the now-unused extractGitStatusLineMap helper, and cancels the background reviewer job before clearing its id in the reviewer-skip branch. All changes have test coverage and pass a full-repo typecheck.
gitDisciplineSection now documents that git-committer requires params.owned_paths as a hard allowlist and lists the optional params keys (branch_name, branch_switch, allow_dirty_branch, push, remote), targeting the observed empty-params spawn failure.

specialistRoutingSection now names the exact snapshot param contract: reviewer-family specialists need params.snapshot_id from get_change_review_bundle, while security-reviewer needs params.changed_files plus params.snapshot_fingerprint.

Add topic-coverage tests for the new guidance plus a gateAwarenessSection coverage test, and switch the specialist-routing test to a top-level import. All changes pass the agents typecheck and the prompt test suite (12 tests).
Tighten shared craftsmanship guidance so orchestrator agent spawns supply the params the runtime actually requires, reducing avoidable spawn rejections.

- gitDisciplineSection: state the git-committer param key is literally owned_paths (not paths/filePaths/files) and name the runtime failure "Missing required: owned_paths" for any other key.

- gitDisciplineSection: document that spawning git-committer before the validation/reviewer gate passes fails with "Spawning git-committer is not available yet", so wait for the gate to report passed first.

- base2 tool-fallbacks guidance: name required spawn params for code-searcher (params.searchQueries) and basher (params.command).

- Add topic-coverage tests guarding all the new guidance.
@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openbuff Ready Ready Preview, Comment, Open in v0 Jul 23, 2026 11:21am

@AnzoBenjamin
AnzoBenjamin merged commit 49e0b58 into main Jul 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant